package org.example.base.mqtt;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@ConditionalOnProperty(prefix = "mqtt", name = "enable", havingValue = "true")
public class MqttConsumeErrorListener {
    @ServiceActivator(inputChannel = "mqttInputErrorChannel")
    public void receiveMessage(String payload, @Header("mqtt_topic") String topic) {
       log.info("error receiveMessage: payload={},  topic={}", payload,  topic);
    }
}
